package cn.chenhongchao.zhaobiaopingtai.service.impl;

import cn.chenhongchao.zhaobiaopingtai.entity.Users;
import cn.chenhongchao.zhaobiaopingtai.entity.UsersExample;
import cn.chenhongchao.zhaobiaopingtai.mapper.UsersMapper;
import cn.chenhongchao.zhaobiaopingtai.service.IUsersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UsersServiceImpl implements IUsersService {

    @Resource
    private UsersMapper usersMapper;

    @Override
    public boolean register(Users users) {
        return usersMapper.insert(users)>0? true:false;
    }

    @Override
    public List<Users> getByUserName(String username) {
        UsersExample example = new UsersExample();
        example.createCriteria()
                .andUsernameEqualTo(username);
        return usersMapper.selectByExample(example);
    }
}
